package cn.ljy.authority.model;

import cn.ljy.common.model.BaseModel;
import cn.ljy.common.model.validate.UpdateWorkValidation;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

@ApiModel(value = "客户信息")
@Data
@EqualsAndHashCode(callSuper = false, of = {"id"})
@NoArgsConstructor
public class SysCustomer extends BaseModel {

    @NotNull(groups = UpdateWorkValidation.class, message = "id不能为空")
    private Long id;

    @NotNull(message = "用户ID不能为空")
    private Long user_id; // 注意：字段名改为下划线命名，与数据库一致

    @NotBlank(message = "真实姓名不能为空")
    @Length(max = 20, message = "真实姓名长度不能超过 {max} 个字符")
    private String name;

    @NotNull(message = "性别不能为空")
    private Integer sex; // 性别：0:保密, 1:男, 2:女

    private java.util.Date birthday; // 生日字段，允许为空

    @Length(max = 100, message = "地址长度不能超过 {max} 个字符")
    private String address; // 地址字段，允许为空

    // 非数据库字段（可选）
    private Integer roleNumber;
    private Integer permissionNumber;

    // 用于接收前端数据
    private Integer[] roleIds;

    // 关联的用户信息
    private SysUser user;
    private Long userID;

    public SysCustomer(Long id) {
        this.id = id;
    }
}